#include "Subject.h"

namespace Observer{
    Subject::Subject() {
        observers = std::list<Obs*>{};
    }

    void Subject::attach(Obs* observer) {
        observers.push_back(observer);
    }

    void Subject::detach(Obs* observer) {
        observers.remove(observer);
    }

    void Subject::notify() {
        for(auto i : observers){
            i->update(this);
        }
    }
}